/**
 * <p>
 * 用户注册
 * </p>
 * 
 * @author ztjie
 */
$(function(){
	$(".message_box").hide();
	var _mobileDom = $('#mobilePhone'),
		mobileNum = function() {
			var mobileVlue = _mobileDom.val();
			if (!Validation.isNotEmpty(mobileVlue)) {
				$(".message_box").show();
				$("#regMobileInfo_span").html("手机号不能为空");
				return false;
			}
			if (!Validation.isMobileNum(mobileVlue)) {
				$(".message_box").show();
				$("#regMobileInfo_span").html("手机号码格式错误");
				return false;
			} else {
				$(".message_box").hide();
				$("#regMobileInfo_span").html("");
				return true;
			}
		};
	_mobileDom.blur(function() {
		return mobileNum();
	});
	document.getElementById("tc_tyname1").style.height = (document.body.scrollHeight) + "px";
	$(".inphone_sublit").click(function() {
		if(mobileNum()){
			$("#userPhoneText").html('+86&nbsp;' + _mobileDom.val());
			$(".tc_main").show();			
		}
	});

	$("#okButton").click(function() {
		$.ajax({
			type: "POST",
			url: SystemConfig.baseServiceUrl + 'verify/sendVerifyCode',
			dataType: "json",
			data: $.toJSON({"mobilePhone": _mobileDom.val(), 'verifyCodeType': 1}),
			contentType: "application/json; charset=UTF-8",
			success : function(data){
				$(".tc_main").hide();
				window.location.href = SystemConfig.baseHtmlUrl+"login.html?mobile_phone="+_mobileDom.val();
			},
			exception:function(data){
				alert(data.responseStatus.message);
			},
			unknownexception : function(data, textStatus, XMLHttpRequest) {
				alert(data.responseStatus.message);
			}
		});
	});

	$(".user_close").click(function() {
		$(".tc_main").hide();
	});
});